<template>
	<view class="p-20">
		<view class="mb-40 p-30 bg-white">
			<view class="font-bold font-24">反馈意见</view>
			<view class="form-input mt-20">
				<textarea placeholder="请输入反馈意见" auto-height style="width: 100%;" v-model="info"/>
			</view>
		</view>
		<view class="bottom-view">
			<view class="bottom-btn font-white bg-g" @click="submit">提交</view>
		</view>
	</view>
</template>

<script>
import { addLeaveword } from '../../api/common';
	export default {
		data() {
			return {
				info: ''
			};
		},
		onLoad() {
			
		},
		methods: {
			submit() {
				const _this = this
				this.$tips.showModal('是否提交？', () => {
					// _this.$tips.showConfirmModal('提交成功', () => {
					// 	uni.navigateBack()
					// })
					if (this.info !== '' ) {
						addLeaveword({
							info: this.info,
							type: '小程序意见反馈'
						}).then(res => {
							if (res.code === 200) {
								_this.$tips.showConfirmModal('提交成功', () => {
									uni.navigateBack()
								})
							} else {
								_this.$tips.showConfirmModal('提交失败', () => {})
							}
						})
					} else {
						this.$tips.showConfirmModal('请先填写反馈意见')
					}
				})
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #f6f6f6;
	}
	
	.bottom-view {
		width: 100vw;
		padding: 40rpx 0;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 99999;
		border-top: 1px solid #efefef;
		.bottom-btn {
			width: 80vw;
			margin: auto;
			text-align: center;
			border-radius: 50rpx;
			padding: 20rpx 0;
		}
	}
</style>
